package com.geek.framework.study.config.anno;

import com.geek.framework.study.config.support.ConfigSourceFactory ;

import java.lang.annotation.*;

import static org.eclipse.microprofile.config.spi.ConfigSource.DEFAULT_ORDINAL;

/**
 * {@link org.eclipse.microprofile.config.spi.ConfigSource}
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Repeatable(ResourceConfigSources.class)
public @interface ResourceConfigSource {


    /**
     * {@link org.eclipse.microprofile.config.spi.ConfigSource#getName()}
     * @return
     */
    String name() default "";

    /**
     * multiple value
     * {@link org.eclipse.microprofile.config.spi.ConfigSource#getValue(String)}
     * @return
     */
    String[] value();


    /**
     * {@link org.eclipse.microprofile.config.spi.ConfigSource#getOrdinal()}
     * @return
     */
    int ordinal() default DEFAULT_ORDINAL;


    /**
     * Indicate if failure to find the a {@link #value() property resource} should be
     * ignored.
     * <p>{@code true} is appropriate if the properties file is completely optional.
     * Default is {@code false}.
     */
    boolean ignoreResourceNotFound() default false;

    /**
     * A specific character encoding for the given resources, e.g. "UTF-8".
     */
    String encoding() default "";

    /**
     *
     * @return
     */
    Class<? extends ConfigSourceFactory> factory() default ConfigSourceFactory.class;

}
